package com.example.demo.util;

import java.io.*;
import java.util.HashSet;
import java.util.Set;

public class FileUtil {

	public static Set<String> readPhones(InputStream in) {
		Set<String> set= null;
		try {
			set = new HashSet<String>();
			BufferedReader br = new BufferedReader(new InputStreamReader(in));
			String line;
			while ((line = br.readLine()) != null) {
				if (!DevUtil.isNull(line)) {
					set.add(line);
				}
			}
			close(br);
		} catch (Exception e) {
			LogUtil.getInstance().logError("readPhones",e);
		}
		return set;
	}

	public static void close(Reader rd) {
		try {
			if (null != rd) {
				rd.close();
			}
		} catch (IOException e) {
			LogUtil.getInstance().logError("closeReader",e);
		}
	}
}
